package cn.xiongxf.feignclient;

import cn.xiongxf.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@FeignClient(value = "user-server",fallbackFactory = UserFeignClientFallbackFactory.class)  // 服务名，托底工厂类
public interface UserService {
    /**
     * OpenFeign调用User服务接口，默认底层会帮助我们创建动态代理实现类，使用RestTemplate进行调用
     * 接口：通过id查询
     * @param id
     * @return
     */
    @GetMapping("/getById/{id}")
    User getById(@PathVariable Long id);

}
